package main

import (
	"basic"
)

//return xxx这一条语句并不是一条原子指令!
//整个return过程:赋值指令 + CALL defer指令 + RET指令。
/*
返回值 = xxx
调用defer函数
空的return
 */
func test_defer() (result int) { // return 1
	result = 22
	defer func() {
		result++ //result = 0 + 1
	}()
	return 0 //result = 0
}

func test_defer2() (r int) { //return 5
	t := 5
	defer func() {
		t = t + 5 //返回值r没被修改过
	}()
	return t //r = t
}

func main() {
	//fmt.Println(test_defer2())

	basic.Pointer_demo()

}
